package cn.stylefeng.guns.sys.modular.system.service.impl;

import cn.hutool.core.collection.CollectionUtil;
import cn.stylefeng.guns.base.pojo.page.LayuiPageFactory;
import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo;
import cn.stylefeng.guns.sys.core.util.DingdingUtil;
import cn.stylefeng.guns.sys.core.util.UUIDUtils;
import cn.stylefeng.guns.sys.modular.system.entity.BtyReemploy;
import cn.stylefeng.guns.sys.modular.system.entity.Dict;
import cn.stylefeng.guns.sys.modular.system.mapper.BtyReemployMapper;
import cn.stylefeng.guns.sys.modular.system.model.params.BtyReemployParam;
import cn.stylefeng.guns.sys.modular.system.model.result.ArchivesResult;
import cn.stylefeng.guns.sys.modular.system.service.ArchivesService;
import cn.stylefeng.guns.sys.modular.system.service.BtyReemployService;
import cn.stylefeng.guns.sys.modular.system.service.DictService;
import cn.stylefeng.roses.core.util.ToolUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dingtalk.api.response.OapiSmartworkHrmEmployeeV2ListResponse;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * <p>
 * 再次入职人员服务实现类
 * </p>
 *
 * @author tz
 * @since 2022-05-05
 */
@Service
public class BtyReemployServiceImpl extends ServiceImpl<BtyReemployMapper, BtyReemploy> implements BtyReemployService {


    @Override
    public void batchDelete(List<String> reemployIds) {
        this.baseMapper.batchUpdateByIds(reemployIds);
    }

    @Override
    public LayuiPageInfo findPageBySpec(BtyReemployParam param) {
        Page pageContext = getPageContext();
        IPage page = this.baseMapper.reemployPageList(pageContext, param);
        return LayuiPageFactory.createPageInfo(page);
    }

    @Override
    public List<BtyReemploy> reemployList(BtyReemployParam param) {
        return this.baseMapper.reemployList(param);
    }

    @Override
    public List<BtyReemploy> getEntryEmpList(int dayNum) {
        return this.baseMapper.getEntryEmpList(dayNum);
    }

    @Override
    public List<BtyReemploy> existReemployEmpList(List<ArchivesResult> dgdLeaveEmpList) {
        return this.baseMapper.existReemployEmpList(dgdLeaveEmpList);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public Integer addList(List<BtyReemploy> list){
        return this.baseMapper.addList(list);
    }

    @Override
    public List<String> getOpenidList() {
        return this.baseMapper.getOpenidList();
    }

    @Override
    public int updateSendStatusByIds(List<String> reemployIds) {
        return this.baseMapper.updateSendStatusByIds(reemployIds);
    }

    private Page getPageContext() {
        return LayuiPageFactory.defaultPage();
    }



}
